#!/usr/bin/env bash
# Check that Cobbler can rename distros

source ${SYSTESTS_PRELUDE} && prepare

set -x -e -o pipefail

cobbler distro add --name fake --arch x86_64 --kernel ${fake_kernel} \
	--initrd ${fake_initramfs}
cobbler profile add --name fake --distro fake
cobbler distro rename --name fake --newname fake-renamed

[ ! -e ${path_collections}/distros/fake.json ]
[   -e ${path_collections}/distros/fake-renamed.json ]

echo fake-renamed >${tmp}/a
cobbler profile dumpvars --name fake | awk '/^distro_name:/{print $2}' >${tmp}/b
diff ${tmp}/{a,b}
